<%inherit file="/base.mako"/>
${h.link_to('List', h.url_for(action='index', id=None))}
<br/>
${h.form(h.url(action='save_edit'), method='post', multipart=True)}
Name: ${h.text_field('name', c.product.name)}
<br/>
Brand: ${h.select('brand_id',  h.format_options(c.brands, value_prop='id', caption_prop='name', add_empty=True, selected_value=c.product.brand.id if c.product.brand != None else None))}
<br/>
Image:  
% if c.product.main_image != '':
	${h.tag('img', src=h.url_for(controller='image', action='index', id=c.product.main_image.file_name, image_id=c.product.main_image.id, width='100', height='100'))}
% endif
${h.file_field('main_image')} <br />
Description: ${h.text_area('description', c.product.description)}
<br/>
% for item in c.product.category.properties:
${item.code}: ${h.text_field('$prop.' + item.code, c.product.properties.get(item.code))}
<br/>
% endfor
            ${h.submit(u'Save')}
${h.end_form()}